# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>
_libname=bcel
pkgname=java-${_libname}
pkgver=5.2
pkgrel=1
pkgdesc="Java library to analyze, create, and manipulate (binary) Java class files"
arch=('any')
url="http://commons.apache.org/bcel/"
license=('APACHE')
depends=('java-runtime-headless')
makedepends=('apache-ant' 'junit')
source=(http://archive.apache.org/dist/jakarta/${_libname}/source/${_libname}-${pkgver}-src.tar.gz
        http://archive.apache.org/dist/jakarta/regexp/binaries/jakarta-regexp-1.2.tar.gz)
md5sums=('905b7e718e30e7ca726530ecf106e532'
         '73aa60b63da140b4a461b46c33082eec')

build() {
  cd "${srcdir}/${_libname}-${pkgver}"
  # "-Dbuild.sysclasspath=only" prevents ant from downloading regexp
  export ANT_OPTS=-Dfile.encoding=iso-8859-1
  ant \
    -Dbuild.sysclasspath=only \
    -lib ${srcdir}/jakarta-regexp-1.2/jakarta-regexp-1.2.jar \
    jar
}

package() {
  cd "${srcdir}/${_libname}-${pkgver}/target"
  install -Dm644 ${_libname}-${pkgver}.jar ${pkgdir}/usr/share/java/${_libname}-${pkgver}.jar
  ln -s ${_libname}-${pkgver}.jar ${pkgdir}/usr/share/java/${_libname}.jar
}
